package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.FamilyInformation;
import cn.wolfcode.crm.mapper.FamilyInformationMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IFamilyInformationService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class FamilyInformationServiceImpl implements IFamilyInformationService {
    @Autowired
    private FamilyInformationMapper familyInformationMapper;

    public void insert(FamilyInformation record) {
        familyInformationMapper.insert(record);
    }
    public void updateByPrimaryKey(FamilyInformation record) {
        familyInformationMapper.updateByPrimaryKey(record);
    }

    public PageResult query(QueryObject qo) {
        int total = familyInformationMapper.query4Count(qo);
        if (total > 0) {
            return new PageResult(total, familyInformationMapper.query4List(qo));
        }
        return new PageResult(total, Collections.EMPTY_LIST);
    }

    public List<FamilyInformation> selectAll() {
        return familyInformationMapper.selectAll();
    }

    public List<FamilyInformation> selectByEmployeeId(Long empId) {
        return familyInformationMapper.selectByEmployeeId(empId);
    }

    public FamilyInformation selectByPrimaryKey(Long id) {
        return familyInformationMapper.selectByPrimaryKey(id);
    }
}
